<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<FiltronASP.Areas.Admin.ViewModels.Pages.PagesIndexViewModel>" %>
<%@ Import Namespace="FiltronASP.Helpers.HtmlTags" %>
<%@ Import Namespace="FiltronASP.Helpers.Routes" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Zarządzanie stronami
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="right-page-buttons2">
        <% Html.RenderPartial("TopIndexButtons"); %>
    </div>  
    <table class="right-pages">
	    <tbody>
	        <% if (Model.CurrentPageType == null) { %>
                <tr class="right-row">
                    <td class="right-cell-big">Nie wybrano grupy stron.</td>
                </tr>            
            <% } else if ((Model.PaginatedPages == null) || (Model.PaginatedPages.Count == 0)) { //if null   %>
                <tr class="right-row">
                    <td class="right-cell-big">Brak elementów do wyświetlenia.</td>
                </tr>
            <% } else { //if page type null   %>
                <% foreach (var page in Model.PaginatedPages) { %>
                    <% if ((Model.PaginatedPages.IndexOf(page) % 2) == 0) { %>
                        <tr class="right-row">
                            <td class="right-cell-big">
                                <% if (Model.CurrentLanguage != null) { %>                                
                                    <%= Html.ActionLinkWithImage("admin-right-doc.png", page.page_name,
                                                                        "ShowPage", new { 
                                                                            pageId = (page.page_id),
                                                                            currentLanguageId = (Model.CurrentLanguage.language_id)
                                                                        })%>
                                <% } else { %>                                                                        
                                    <%= Html.ActionLinkWithImage("admin-right-doc.png", page.page_name,
                                                                        "ShowPage", new { 
                                                                            pageId = (page.page_id)
                                                                        })%>
                                <% }    //else  %>
					        </td>
					        <td class="right-cell-small">
                                <% if (Model.CurrentLanguage != null) { %>                                					        
    					            <% if (Model.PaginatedPages.IndexOf(page) != 0) { %>
	    				                <%= Html.ActionLinkWithImage("admin-right-up1.png", 
		    			                    String.Empty, "PageOneUp", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if not first %>
					                <% if (Model.PaginatedPages.IndexOf(page) != (Model.PaginatedPages.Count - 1)) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-down1.png", 
					                        String.Empty, "PageOneDown", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
	    				            <% } //if not last %>
                                <% } else { %>        	    				            
    					            <% if (Model.PaginatedPages.IndexOf(page) != 0) { %>
	    				                <%= Html.ActionLinkWithImage("admin-right-up1.png", 
		    			                    String.Empty, "PageOneUp", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if not first %>
					                <% if (Model.PaginatedPages.IndexOf(page) != (Model.PaginatedPages.Count - 1)) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-down1.png", 
					                        String.Empty, "PageOneDown", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
	    				            <% } //if not last %>
                                <% }    //else %>
					        </td>
					        <td class="right-cell-small">
                                <% if (Model.CurrentLanguage != null) { %>                                					        
    					            <% if (Model.PaginatedPages.IndexOf(page) != 0) { %>
	    				                <%= Html.ActionLinkWithImage("admin-right-uptop.png", 
		    			                    String.Empty, "PageTopUp", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id),
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if not first %>
					                <% if (Model.PaginatedPages.IndexOf(page) != (Model.PaginatedPages.Count - 1)) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-downbottom.png", 
					                        String.Empty, "PageBottomDown", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id),
                                                currentLanguageId = (Model.CurrentLanguage.language_id),
                                                paginationPage = (Model.PaginatedPages.PageIndex)
                                            })%>    
		    			            <% } //if not last %>
                                <% } else { %>		    			            
    					            <% if (Model.PaginatedPages.IndexOf(page) != 0) { %>
	    				                <%= Html.ActionLinkWithImage("admin-right-uptop.png", 
		    			                    String.Empty, "PageTopUp", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id),
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if not first %>
					                <% if (Model.PaginatedPages.IndexOf(page) != (Model.PaginatedPages.Count - 1)) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-downbottom.png", 
					                        String.Empty, "PageBottomDown", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id),
                                                paginationPage = (Model.PaginatedPages.PageIndex)
                                            })%>    
		    			            <% } //if not last %>
                                <% } //else %>
					        </td>
					        <td class="right-cell-mid">
					            <% if (page.page_removable) { %>
                                    <% if (Model.CurrentLanguage != null) { %>                                					        					            
    					                <%= Html.ActionLinkWithImage("admin-right-remove.png", 
	    				                    " Usuń", "DeletePage", new { pageToDeleteId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
                                    <% } else { %>                                                
    					                <%= Html.ActionLinkWithImage("admin-right-remove.png", 
	    				                    " Usuń", "DeletePage", new { pageToDeleteId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
                                    <% }    //else %>
					            <% } //if delete %>
					        </td>
					        <td class="right-cell-mid">
					            <% if (page.page_editable) { %>
                                    <% if (Model.CurrentLanguage != null) { %>                                					        					            
    					                <%= Html.ActionLinkWithImage("admin-right-edit.png", 
	    				                    " Edytuj", "EditPage", new { pageToEditId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
                                    <% } else { %>                                                
    					                <%= Html.ActionLinkWithImage("admin-right-edit.png", 
	    				                    " Edytuj", "EditPage", new { pageToEditId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
                                    <% } %>
					            <% } //if removable %>
                            </td>
					        <td class="right-cell-mid">
                                <% if (Model.CurrentLanguage != null) { %>                                					        					            
					                <% if (page.page_published) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-published.png", 
					                        " Ukryj", "HidePage", new { pageToHideId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
		    			            <% } else { //if published %>
			    		                <%= Html.ActionLinkWithImage("admin-right-unpublished.png", 
				    	                    " Publikuj", "PublishPage", new { pageToPublishId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if hidden %>
                                <% } else { %>					                
					                <% if (page.page_published) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-published.png", 
					                        " Ukryj", "HidePage", new { pageToHideId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
		    			            <% } else { //if published %>
			    		                <%= Html.ActionLinkWithImage("admin-right-unpublished.png", 
				    	                    " Publikuj", "PublishPage", new { pageToPublishId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if hidden %>
                                <% }    //else %>
					        </td>
                        </tr>					       
                    <% } else { //if odd row %>                       
                        <tr class="right-row altrow">
                                                       <td class="right-cell-big">
                                <% if (Model.CurrentLanguage != null) { %>                                
                                    <%= Html.ActionLinkWithImage("admin-right-doc.png", page.page_name,
                                                                        "ShowPage", new { 
                                                                            pageId = (page.page_id),
                                                                            currentLanguageId = (Model.CurrentLanguage.language_id)
                                                                        })%>
                                <% } else { %>                                                                        
                                    <%= Html.ActionLinkWithImage("admin-right-doc.png", page.page_name,
                                                                        "ShowPage", new { 
                                                                            pageId = (page.page_id)
                                                                        })%>
                                <% }    //else  %>
					        </td>
					        <td class="right-cell-small">
                                <% if (Model.CurrentLanguage != null) { %>                                					        
    					            <% if (Model.PaginatedPages.IndexOf(page) != 0) { %>
	    				                <%= Html.ActionLinkWithImage("admin-right-up1.png", 
		    			                    String.Empty, "PageOneUp", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if not first %>
					                <% if (Model.PaginatedPages.IndexOf(page) != (Model.PaginatedPages.Count - 1)) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-down1.png", 
					                        String.Empty, "PageOneDown", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
	    				            <% } //if not last %>
                                <% } else { %>        	    				            
    					            <% if (Model.PaginatedPages.IndexOf(page) != 0) { %>
	    				                <%= Html.ActionLinkWithImage("admin-right-up1.png", 
		    			                    String.Empty, "PageOneUp", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if not first %>
					                <% if (Model.PaginatedPages.IndexOf(page) != (Model.PaginatedPages.Count - 1)) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-down1.png", 
					                        String.Empty, "PageOneDown", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
	    				            <% } //if not last %>
                                <% }    //else %>
					        </td>
					        <td class="right-cell-small">
                                <% if (Model.CurrentLanguage != null) { %>                                					        
    					            <% if (Model.PaginatedPages.IndexOf(page) != 0) { %>
	    				                <%= Html.ActionLinkWithImage("admin-right-uptop.png", 
		    			                    String.Empty, "PageTopUp", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id),
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if not first %>
					                <% if (Model.PaginatedPages.IndexOf(page) != (Model.PaginatedPages.Count - 1)) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-downbottom.png", 
					                        String.Empty, "PageBottomDown", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id),
                                                currentLanguageId = (Model.CurrentLanguage.language_id),
                                                paginationPage = (Model.PaginatedPages.PageIndex)
                                            })%>    
		    			            <% } //if not last %>
                                <% } else { %>		    			            
    					            <% if (Model.PaginatedPages.IndexOf(page) != 0) { %>
	    				                <%= Html.ActionLinkWithImage("admin-right-uptop.png", 
		    			                    String.Empty, "PageTopUp", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id),
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if not first %>
					                <% if (Model.PaginatedPages.IndexOf(page) != (Model.PaginatedPages.Count - 1)) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-downbottom.png", 
					                        String.Empty, "PageBottomDown", new { pageToMoveId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id),
                                                paginationPage = (Model.PaginatedPages.PageIndex)
                                            })%>    
		    			            <% } //if not last %>
                                <% } //else %>
					        </td>
					        <td class="right-cell-mid">
					            <% if (page.page_removable) { %>
                                    <% if (Model.CurrentLanguage != null) { %>                                					        					            
    					                <%= Html.ActionLinkWithImage("admin-right-remove.png", 
	    				                    " Usuń", "DeletePage", new { pageToDeleteId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
                                    <% } else { %>                                                
    					                <%= Html.ActionLinkWithImage("admin-right-remove.png", 
	    				                    " Usuń", "DeletePage", new { pageToDeleteId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
                                    <% }    //else %>
					            <% } //if delete %>
					        </td>
					        <td class="right-cell-mid">
					            <% if (page.page_editable) { %>
                                    <% if (Model.CurrentLanguage != null) { %>                                					        					            
    					                <%= Html.ActionLinkWithImage("admin-right-edit.png", 
	    				                    " Edytuj", "EditPage", new { pageToEditId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
                                    <% } else { %>                                                
    					                <%= Html.ActionLinkWithImage("admin-right-edit.png", 
	    				                    " Edytuj", "EditPage", new { pageToEditId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
                                    <% } %>
					            <% } //if removable %>
                            </td>
					        <td class="right-cell-mid">
                                <% if (Model.CurrentLanguage != null) { %>                                					        					            
					                <% if (page.page_published) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-published.png", 
					                        " Ukryj", "HidePage", new { pageToHideId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
		    			            <% } else { //if published %>
			    		                <%= Html.ActionLinkWithImage("admin-right-unpublished.png", 
				    	                    " Publikuj", "PublishPage", new { pageToPublishId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                currentLanguageId = (Model.CurrentLanguage.language_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if hidden %>
                                <% } else { %>					                
					                <% if (page.page_published) { %>
					                    <%= Html.ActionLinkWithImage("admin-right-published.png", 
					                        " Ukryj", "HidePage", new { pageToHideId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
		    			            <% } else { //if published %>
			    		                <%= Html.ActionLinkWithImage("admin-right-unpublished.png", 
				    	                    " Publikuj", "PublishPage", new { pageToPublishId = (page.page_id), 
                                                currentPageTypeId = (Model.CurrentPageType.page_type_id), 
                                                paginationPage = (Model.PaginatedPages.PageIndex)} )%>    
					                <% } //if hidden %>
                                <% }    //else %>
					        </td>
                        </tr>					       
                    <% } //else odd row %>                       
                <% }    //foreach %>
            <% }    //else null %>
	    </tbody>
    </table>
    <div class="right-pagination">
        <% if ((Model.PaginatedPages != null) && (Model.PaginatedPages.Count > 0)) { %>
            <% if (Model.PaginatedPages.HasPreviousPage) { %>            
                <a href="<%= Url.GeneratePagesListRoute(1, Model.CurrentPageType, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-first.png")%>" alt="pierwsza" />
                </a>
                <a href="<%= Url.GeneratePagesListRoute(Model.PaginatedPages.PageIndex - 1, Model.CurrentPageType, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-prev.png")%>" alt="poprzednia" />
                </a>
            <% } //if prev %>
            <% if ((Model.PaginatedPages.HasPreviousPage) || (Model.PaginatedPages.HasNextPage)) { %>
                &nbsp;&nbsp;
                Strona <%= Model.PaginatedPages.PageIndex%> z <%= Model.PaginatedPages.PagesCount%>
                &nbsp;&nbsp;
            <% } //if %>
            <% if (Model.PaginatedPages.HasNextPage) { %>
                <a href="<%= Url.GeneratePagesListRoute(Model.PaginatedPages.PageIndex + 1, Model.CurrentPageType, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-next.png")%>" alt="następna" />
                </a>
                <a href="<%= Url.GeneratePagesListRoute(Model.PaginatedPages.PagesCount, Model.CurrentPageType, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-last.png")%>" alt="ostatnia" />
                </a>
            <% } //if next %>    
        <% } //if not null and not empty %>    
    </div>    	                   
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <% if (Model.CurrentPageType == null) { %>	
        Zarządzanie stronami
    <% } else { //if null %>        
        <%= Model.CurrentPageType.page_type_name %>
    <% } //else null %>        
</asp:Content>
